package me.zhengjie.modules.gis.domainTrans;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Date;

/**
* 地磅数据(事业部地磅系统原始数据)
**/
@Entity
@Data
@Table(name="table_warehouse_weight_list")
@ApiModel("武进事业部地磅数据")
public class TransWeightData implements Serializable {

    @Id
    @Column(name = "`ID`")
    @ApiModelProperty(value = "主键自增ID")
    private Long vortexId;

    @Column(name = "`List_TPYE`")
    @ApiModelProperty(value = "本车单据类型 采购单 销售单 工程单")
    private String listType;

    @Transient
    @ApiModelProperty(value = "发货地点")
    private String sourceUnit;

    @Transient
    @ApiModelProperty(value = "进料的发货地或出料的项目地所在行政区")
    private String area;

    @Transient
    @ApiModelProperty(value = "处置单位(出料项目地)名称")
    private String handleUnit;

    @Transient
    @ApiModelProperty(value = "车间名称")
    private String productToWhere;

    @Transient
    @ApiModelProperty(value = "运输类型 0：出料 1：进料")
    private String transportUnitInnerCode;

    @Column(name = "`Project_Name`")
    @ApiModelProperty(value = "项目名称")
    private String projectName;

    @Column(name = "`Customer_Name`")
    @ApiModelProperty(value = "客户名称")
    private String customerName;

    @Column(name = "`Driver`")
    @ApiModelProperty(value = "司机")
    private String driver;

    @Column(name = "`Driver_ID`")
    @ApiModelProperty(value = "司机身份证")
    private String driverId;

    @Column(name = "`Driver_Phone`")
    @ApiModelProperty(value = "司机手机号")
    private String driverPhone;

    @Column(name = "`Tare_Weight`")
    @ApiModelProperty(value = "皮重（吨）")
    private BigDecimal tareWeight;

    @Column(name = "`Gross_Weight`")
    @ApiModelProperty(value = "毛重（吨）")
    private BigDecimal grossWeight;

    @Column(name = "`Net_Weight`")
    @ApiModelProperty(value = "净重（吨）")
    private BigDecimal netWeight;

    @Column(name = "`Truck_License`")
    @ApiModelProperty(value = "车牌号")
    private String carNo;

    @Column(name = "`Transport_Unit_Name`")
    @ApiModelProperty(value = "运输单位")
    private String transportUnit;

    @Column(name = "`Goods_Name`")
    @ApiModelProperty(value = "货物名称")
    private String productName;

    @Column(name = "`Gross_Weight_Time`")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "进厂时间")
    private Date grossTime;


    public void copy(TransWeightData source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
